package org.association.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.association.entity.NormalProposal;

@Mapper
public interface NormalProposalDao extends BaseMapper<NormalProposal> {


    @Update(
            "UPDATE t_normal_proposal SET agree_people_sum = agree_people_sum + 1 WHERE proposal_id = #{id}"
    )
    void voteProposalAgreeUpdate(@Param("id") String id);

    @Update(
            "UPDATE t_normal_proposal SET disagree_people_sum = disagree_people_sum + 1 WHERE proposal_id = #{id}"
    )
    void voteProposalDisagreeUpdate(@Param("id") String id);


    @Update(
            "UPDATE t_normal_proposal SET is_executed = 1 WHERE proposal_id = #{id}"
    )
    void setProposalSucceed(@Param("id") String id);
}
